function rqFormatter(val, row) {
	return (!val) ? "暂无" : backendCommon.dateTimeToLocalStringWithSeconds(val);
}

function sfscFormatter(val, row) {
	if (0 == val) {
		return "未删除";
	}
	if (1 == val) {
		return "已删除";
	}
}

function editSelected() {
    var row = $('#tbDatagrid').datagrid('getSelected');
    if(!row){
        $.messager.alert('提示', "请选择一条数据!", 'info');
        return;
    }
    $('#ff').form('load', {
        id: row.id,
        cash:row.cash,
        isflag: 1
    });
    $('#settjDlg').dialog('open').dialog('center');
}

function newRow() {
	$('#ff').form('load', {
		cash:'',
        isflag: 0
    });
    $('#settjDlg').dialog('open').dialog('center');
}

function tjSave() {
	$('#ff').form('submit', {
		onSubmit : function() {
			return $(this).form('validate');
		},
		success : function(result) {
			var result = eval('(' + result + ')');
			if (result.success) {
				$('#settjDlg').dialog('close');
				$('#tbDatagrid').datagrid('reload');
			} else {
				$.messager.alert('提示', result.message, 'info');
			}
		}
	});
}

function deleteSelected() {
    var row = $('#tbDatagrid').datagrid('getSelected');
    if(!row){
        $.messager.alert('提示', "请选择一条数据!", 'info');
        return;
    }
    $.ajax( {  
        type : 'POST',  
        url : mainDomain + '/btbz/neworedit.action',  
        data : 'id='+row.id+'&isflag='+2,
        dataType: "json",
        success : function(result) {
			if (result.success) {
				$('#tbDatagrid').datagrid('reload');
			} else {
				$.messager.alert('提示', result.message, 'info');
			}
		}
      });
}